<?php

namespace Admin\Controller;

use Zend\View\Model\ViewModel;
use Admin\Controller\IndexController;
use Admin\Model\DBO\UserDBO;
use Admin\Entity\User;

class ListUserController extends IndexController {

    public $userTable;

    public function indexAction() {
        // chi co quyền admin mới vào được 
        $this->checkRole1();
        // Neu dang nhap roi thi hien thi len sach sach nguoi dung
        // Lay thuc the dang nhap dua ra layout
        $this->layout()->identity = $this->getAuthService()->getIdentity();
        // Hien thi dua sanh sach nguoi dung ra view
        // grab the paginator from the AlbumTable
        $objectUserDBO = new UserDBO($this->getServiceLocator());
        $paginator = $objectUserDBO->fetchAll(true);
        // set the current page to what has been passed in query string, or to 1 if none set
        $paginator->setCurrentPageNumber((int) $this->params()->fromQuery('page', 1));
        // set the number of items per page to 10
        $paginator->setItemCountPerPage(2);
        $paginator->setPageRange(5);

        return new ViewModel(array(
            'paginator' => $paginator
        ));
    }

    public function detailUserAction() {
        
    }

}